package com.sj.增删改查结点;

/**
 * @author sj
 * @date 2021/5/3
 **/
public class 判断是否有环 {
    public static boolean BLcricle(LinkNode head){
        if (head == null || head.next == null)return false;
        LinkNode slow = head;
        LinkNode fast = head.next;
        while (fast != slow){
            if (fast == null || fast.next == null){
                return false;
            }
            slow = slow.next;
            fast = fast.next;
        }
        return true;
    }
}
